<?php

  class Float extends Base implements IFloat {
    /** @var float The real float to work on. */
    private $float = null;

    /**
     * Instantiate a new float object with the given float value.
     * @param float $value The real float value.
     */
    public function __construct($value) {
      if (is_float($value)) {
        $this->float = $value;
      } else {
        throw new IllegalArgumentException("\$value parameter must be a float.");
      }
    }

    public function __invoke() {
      return $this->float;
    }

    /**
     * Return a new float with the $value parameter.
     * @param float $value The float.
     * @return Float The new float.
     */
    public static function parseFloat($value) {
      return new Float($value);
    }

    /**
     * Returns a string that represent the float value.
     * @return string The string representation of the float value.
     */
    public function toString() {
      return strval($this->float);
    }

    /**
     * Returns a string that represent the float value.
     * @return string The string representation of the float value.
     */
    public function __toString() {
      return strval($this->float);
    }

    /**
     * Returns the real float that the class works with.
     * @return float The real float value.
     */
    public function floatValue() {
      return $this->float;
    }

  }

?>
